from flask import Flask,request
from coupon import bp_coupon
from goods import bp_goods
from users import bp_users
from database import db

import json
# 初始化
app = Flask(__name__)
#注册蓝图
app.register_blueprint(bp_coupon,url_prefix='/coupon')
app.register_blueprint(bp_goods)
app.register_blueprint(bp_users,url_prefix='/user')
# 全局配置跨域
from flask_cors import CORS
cors = CORS(app)

#乱码转换成文字
app.config['JSON_AS_ASCII']=False




# @app.route('/hello')
# def hello():
#     return 'hello world'
#
# @app.route('/add',methods=['post','GET'])
# def add():
#     username = request.form.get('username')
#     password = request.form.get('password')
#     sql = '''insert into teacher(username,password) values('赵四','123')'''
#     db.insert(sql)
#     return 'ok'
#
# @app.route('/get')
# def get():
#     sql = '''select * from teacher'''
#     dd = db.findone(sql)
#     return dd







if __name__ == '__main__':
    app.run(debug=True)
